<%--
  Created by IntelliJ IDEA.
  User: FT
  Date: 2020/9/25
  Time: 14:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>增加会议</title>
    <script>
        $(function () {
            var deptId = $("#deptId").val();
            // console.log(deptId)
            $.ajax({
                url: "${pageContext.request.contextPath}/dept/list",
                type: "post",
                data: "",
                dataType: "json",
                success: function (data) {
                    // alert(data)
                    // console.log(data);
                    // console.log(parentList[1].id);
                    // console.log(sonList[1].parentId);
                    var html = "";
                    for (var i = 0; i < data.length; i++) {
                        html += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
                    }
                    $("#dept").append(html)
                }
            });
            $("#dept").change(function () {
                $.ajax({
                    url: "${pageContext.request.contextPath}/user/getUserByDeptId",
                    type: "post",
                    data: {deptId:$("#dept").val()},
                    dataType: "json",
                    success: function (data) {
                        $("#makeUser").empty();
                        var html = "";
                        for (var i = 0; i < data.length; i++) {
                            html += '<input type="checkbox" name="makeUsers" value="'+data[i].id+'">'+data[i].realName;
                        }
                        $("#makeUser").append(html);
                    }
                });
            })
            // console.log($("#dept"))
        });
    </script>
    <style>
        label{
            margin-top: 2%;
            margin-left: 10%;
            display: inline-block;
            width: 70px;
        }
        .add{
            margin-left: 15%;
            margin-bottom: 2%;
            width: 60px;
            height: 30px;
        }
        .add:hover{
            background-color: red;
        }
       #text{
           width: 400px;
           height: 200px;
       }
        #makeUser{
            display: inline-block;
        }
    </style>
</head>
<body>
    <jsp:include page="/html/commons/top.jsp"></jsp:include>
    <jsp:include page="/html/commons/menu.jsp"></jsp:include>
    <div id="right">
        <form action="${pageContext.request.contextPath}/meeting/insertMeeting" method="post">
            <label>会议标题</label>
            <input type="text" name="title" placeholder="请输入会议名称" id="name"> &nbsp;
            &nbsp;&nbsp;
            <label>部门名称</label>
            <select id="dept" name="deptId">
                <option value="-1">未选择</option>
            </select><br>
            <label>开始时间</label>
            <input type="datetime-local" name="startTime">
            <label>抄送人</label>
            <div id="makeUser">
                <%--<input type="checkbox" name="makeUser" value="">吗--%>
            </div><br>
            <label>结束时间</label>
            <input type="datetime-local" name="endTime">&nbsp;<br><br>
            <label>会议内容</label>
            <%--<input type="" id="text" name="content"><br><br>--%>
            <textarea id="text" name="content"></textarea><br><br>
            <input class="add" type="submit" value="添加">
        </form>
    </div>
</body>
</html>
